/**
 * Apple.js (jQuery)
 * 
 * @version 0.1 (Experimental)
 * @author Tin
 * @dependency jQuery v1.7.1+
 * @dependency Applefy.js v0.1+
 */
(function($) {
	var enableButton = $("#enable"), disableButton = $("#disable");
	$(document).ready(function() {
		var enable = function(which) {
			if (which) {
				enableButton.prop("disabled", null);
				disableButton.prop("disabled", true);
			} else {
				enableButton.prop("disabled", true);
				disableButton.prop("disabled", null);
			}
		};
		$("#main").on("mousedown", function(e) {
			var target = $(e.target);
			if (target.not("button").length) {
				e.preventDefault();
			}
		});
		enableButton.on("click", function() {
			$("#slides").applefy("init", {
				tabs : $("li.menuItem"),
				touch : true,
				activeSlide : 0
			});
			enable(false);
		});
		disableButton.on("click", function() {
			$("#slides").applefy("destroy");
			enable(true);
		});
		enableButton.click();
	});
})(jQuery);